/**
 * 自定义首页接口
 * */


//首页内容
function getHomeList(){
    $.ajax({
        type: apis.home.method,
        url: apis.home.url,
        data: {},
        success: function (res) {
            console.log(res);
            if (res.code < 0) {
                return
            }
            var d = res.data, key;
            for (var i = 0; i < d.length; i ++) {
                key = d[i].fkey;
                if (d[i].ftype == 3) {
                    $('#' + key).attr('src', d[i].fval);
                } else if (d[i].type == 3 && d[i].ftype == 4) {
                    homePart3List({k: key, v: d[i].fval});
                } else if (d[i].type == 5 && d[i].ftype == 4) {
                    homePart5List({k: key, v: d[i].fval});
                } else if (d[i].type == 6 && d[i].ftype == 4) {
                    homePart6List({k: key, v: d[i].fval});
                } else {
                    $('#' + key).html(d[i].fval);
                }
            }
        },
        error: function () {
            console.log('错误辣');
        }
    });
}


//首页数据3列表
function homePart3List(e){
    var d = e.v, key = e.k;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<li data-animation class="image-view" data-img-cursor="<img src=\'images\/what_we_do_img.jpg\'/>">';
        h += '<div class="icon"> <img src="icons/ui-ux.svg" alt="about" class="img-fluid w-100 svg"/> </div>';
        h += '<div class="text">';
        h += '<h3>' + d[i][0] + '</h3>';
        h += '<p>' + d[i][1] + '</p>';
        h += '<div class="img"> <img src="images/what_we_do_img.jpg" alt="what we do" class="img-fluid w-100"/> </div>';
        h += '<a class="circle_btn" href="javascript:;">details</a>';
        h += '</li>';
    }
    $('#' + key).html(h);
}


//首页数据5列表
function homePart5List(e){
    var d = e.v, key = e.k;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<li data-animation>';
        h += '<div class="icon">';
        h += '<img src="images/achivement_icon_1.png" alt="icon" class="img-fluid w-100"/>';
        h += '</div>';
        h += '<div class="text">';
        h += '<h4>' + d[i][0] + '</h4>';
        h += '<span>' + d[i][1] + '</span>';
        h += '<a href="javascript:;" class="achivement_link"> <i class="fx-icon-long-next-arrow"></i> </a>';
        h += '</div>';
        h += '</li>';
    }
    $('#' + key).html(h);
}


//首页数据6列表
function homePart6List(e){
    var d = e.v, key = e.k;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<div class="col-lg-4 col-md-6" data-animation="fade-left">';
        h += '<div class="single_blog">';
        h += '<div class="single_blog_text">';
        h += '<ul class="d-flex flex-wrap">';
        h += '<li>' + d[i][2] + '</li>';
        h += '<li>' + d[i][3] + '</li>';
        h += '</ul>';
        h += '<a class="title" href="javascript:;">' + d[i][0] + '</a>';
        h += '</div>';
        h += '<div class="single_blog_img">';
        h += '<a href="javascript:;" data-cursor=\'<i class="fx-icon-long-next-arrow"></i>\' class="img w-100">';
        h += '<div data-animation="img-blur" class="w-100">';
        h += '<img src="' + d[i][1] + '" alt="blog" class="img-fluid w-100"/>';
        h += '</div>';
        h += '</a>';
        h += '</div>';
        h += '</div>';
        h += '</div>';
    }
    $('#' + key).html(h);
}


//首页2内容
function getHome2List(){
    $.ajax({
        type: apis.home2.method,
        url: apis.home2.url,
        data: {},
        success: function (res) {
            console.log(res);
            if (res.code < 0) {
                return
            }
            var d = res.data, key;
            for (var i = 0; i < d.length; i ++) {
                key = d[i].fkey;
                if (d[i].ftype == 3) {
                    $('#' + key).attr('src', d[i].fval);
                } else if (d[i].ftype == 4) {
                    if (d[i].type == 6) {
                        home2Part6List({k: key, v: d[i].fval});
                    } else if (d[i].type == 7) {
                        home2Part7List({k: key, v: d[i].fval});
                    }
                } else {
                    $('#' + key).html(d[i].fval);
                }
            }
        },
        error: function () {
            console.log('错误辣');
        }
    });
}


//首页2数据6列表
function home2Part6List(e){
    var d = e.v, key = e.k;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<div class="col-xl-4 col-md-6 col-lg-4" data-animation="fade-left">';
        h += '<div class="single_team">';
        h += '<a href="#" class="single_team_img cursor-arrow">';
        h += '<img src="' + d[i][0] + '" class="img-fluid w-100"/>';
        h += '</a>';
        h += '<h3 id="FD00087">' + d[i][1] + '</h3>';
        h += '<p id="FD00088">' + d[i][2] + '</p>';
        h += '</div>';
        h += '</div>';
    }
    $('#' + key).html(h);
}


//首页2数据7列表
function home2Part7List(e){
    var d = e.v, key = e.k;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<div class="col-lg-4 col-md-6" data-animation="fade-left">';
        h += '<div class="single_blog first_blog">';
        h += '<div class="single_blog_text">';
        h += '<a class="title" href="blog_details.html">';
        h += d[i][0];
        h += '</a>';
        h += '</div>';
        h += '<div class="single_blog_img">';
        h += '<ul class="d-flex flex-wrap">';
        h += '<li>';
        h += '<i class="far fa-calendar-check"></i>';
        h += '<span id="FD00100">' + d[i][1] + '</span>';
        h += '</li>';
        h += '<li>';
        h += '<i class="far fa-comment-dots"></i>';
        h += '<span id="FD00101">' + d[i][2] + '</span>';
        h += '</li>';
        h += '</ul>';
        h += '<a href="blog_details.html" data-cursor=\'<i class="fx-icon-long-next-arrow"></i>\' class="img">';
        h += '<img src="' + d[i][3] + '" alt="blog" class="img-fluid w-100" id="FD00102"/>';
        h += '</a>';
        h += '</div>';
        h += '</div>';
        h += '</div>';
    }
    $('#' + key).html(h);
}